package com.inmotion.android.sdk.moor7;

import java.util.HashMap;
import java.util.Map;

public class FlutterRsp {

    boolean success;
    String errorMessage;
    Object data;

    public FlutterRsp(boolean success, String errorMessage, Object data) {
        this.success = success;
        this.errorMessage = errorMessage;
        this.data = data;
    }

    public FlutterRsp(boolean success, String errorMessage) {
        this.success = success;
        this.errorMessage = errorMessage;
    }

    public static FlutterRsp success() {
        return success("");
    }

    public static FlutterRsp success(Object data) {
        return new FlutterRsp(true, "", data);
    }

    public static FlutterRsp success(String msg) {
        return new FlutterRsp(true, msg);
    }

    public static FlutterRsp error(String msg) {
        return new FlutterRsp(false, msg);
    }

    Map<String, Object> toMap() {
        Map<String, Object> map = new HashMap<>();
        map.put("success", success);
        map.put("errorMessage", errorMessage);
        map.put("data", data);
        return map;
    }
}
